//
//  QIangdanResultVC.m
//  OrderSys
//
//  Created by JM on 15/10/11.
//  Copyright © 2015年 zjlskj. All rights reserved.
//

#import "QIangdanResultVC.h"
#import "QIangdanResultVC.h"
#import "OrderCell.h"
#import "STPopup.h"
#import "QiangDanCommitVC.h"
@interface QIangdanResultVC ()<OrderCellProtocol>
@property (nonatomic,strong)NSMutableArray *dataArray;
@end

@implementation QIangdanResultVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.title = @"订单列表";
    
    self.dataArray = [NSMutableArray array];
    OrderModel * model = [OrderModel modelWithDate:@"date" adress:@"adress" number:@"number" price:@"price"];
    [self.dataArray addObject:model];
    
}

#pragma mark-datasource

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableViewz{
    return 1;
}
- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return self.dataArray.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    OrderCell *cell = [tableView dequeueReusableCellWithIdentifier:[OrderCell ID]];
    if (!cell){
        cell = [OrderCell cell];
        cell.delegate = self;
    }
    OrderModel* order = self.dataArray[indexPath.row];
    [cell setOrder:order];
    //赋值
  
    return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return [OrderCell height];
}
#pragma mark-delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    // NSInteger row = indexPath.row;
    
    
}
- (void)clickQiangDan:(OrderCell*) aCell {
    NSIndexPath * indexpath = [self.tableView indexPathForCell:aCell];

    [self showPopup];

}

//／／／／／---------------------
- (void)showPopup
{
    STPopupController *popupController = [[STPopupController alloc] initWithRootViewController:[QiangDanCommitVC new]];
//    popupController.cornerRadius = 4;
//    popupController.transitionStyle = _transitionStyle;
    [popupController presentInViewController:self];
}

@end
